<?php

	$LOCALPATH = realpath(dirname(__FILE__)); 
	require_once( $LOCALPATH . "./classes.php");

	session_start();
 
	$user = null ;
	$message = '';
	if(isset($_SESSION[_AUTH])) {
  		$user = $_SESSION[_AUTH];
	}
	//  var_dump( $_SESSION );
 // var_dump( $_SERVER );
	//  print(" user is >$user<");
	if( $user == null || $user == '' || count($user) == 0 ){
		header("Location: /meter/login.php");
		exit;
	}

	// 	$authorized = FALSE;
	// 	// print(" in authorized ");
	// 	if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
			 
	// 		$input = $_SERVER['PHP_AUTH_USER'] ;
	// 		$pass = $_SERVER['PHP_AUTH_PW'];


	// 		$dao = new AuthDao();
	// 		try{
	// 			$authorized = $dao->auth( $input , $pass);
	// 			if( $authorized )
	// 				$_SESSION[_AUTH] = $input;

	// 		}catch(Exception $e){
	// 			$message = $e->getMessage();
	// 		}

	// 	}  
	// 		   // If not authorized, display authentication prompt or 401 error
	// 	if (! $authorized) {
	// 		header('WWW-Authenticate: Basic Realm="Adapter Management Console"');
	// 	 	header('HTTP/1.0 401 Unauthorized');
	// 		print('You must provide the proper credentials!<br/>');
	// 		print($message);
	// 		exit;
	// 	}  

	// }

	 

 
?> 